'- converts a 128x128 picture into defb/asm byte sequence for Boriel's zxbasic-compiler
finp$="picture.png"
fout$=finp$+".txt":xed=128:yed=128
setdisplay(xed,yed,32,1):paper(8^8-1):ink(0):pen(0):cls
loadimage(finp$,1):pasteicon(0,0,1):open fout$ for output as #1
print #1,"charset01:":print #1,"asm"
for y2=0 to int(yed/8)-1:for x2=0 to int(xed/8)-1
  chidx=x2+(y2*16):a$="  defb 0"
  for y1=0 to 7:for x1=0 to 7 step 4:vtm=0
    for x0=0 to 3
      x=x1+x0+(x2*8):y=y1+(y2*8)
      u=1-(bitwiseand(point(x,y),128)\128)
      vtm=vtm+u*(2^(3-x0))
      next
    a$=a$+hex$(vtm)
    next
   if y1<7 then:a$=a$+"h,0":end if
   next
  a$=a$+"h":print #1,a$
  next:next
print #1,"  end asm"
close #1

